package cn.huiyunche.base.service.vo;

import cn.huiyunche.base.service.enums.PaymentStatusEnum;
import cn.huiyunche.base.service.enums.UserTypeEnum;
import cn.huiyunche.base.service.enums.WaybillStatusEnum;

import java.io.Serializable;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class WaybillNewVo implements Serializable {

    private static final long serialVersionUID = 2072347769320087535L;

    private Long id;

    //运单编号
    private String waybillCode;

    //提车省
    private String departProvinceName;

    //提车市
    private String departCityName;

    // 提车区/县
    private String departCountyName;

    // 提车联系人
    private String departContact;

    // 提车联系人电话
    private String departPhone;

    //交车省
    private String receiptProvinceName;

    //交车市
    private String receiptCityName;

    // 交车区/县
    private String receiptCountyName;

    // 交车联系人
    private String receiptContact;

    // 交车联系人电话
    private String receiptPhone;

    // 提车地址
    private String departAddr;

    // 交车地址
    private String receiptAddr;

    //装车时间
    // @JsonSerialize(using = JsonDateSerializerByLine.class)
    private Date shipmentDate;

    //卸车时间
    // @JsonSerialize(using = JsonDateSerializerByLine.class)
    private Date arriveDate;

    //运单状态
    private Integer status;

    //运单状态显示文本
    private String statusText;

    // 支付状态
    private Integer payStatus;

    // 支付状态 显示文本
    private String payStatusText;

    //运输费
    private BigDecimal cost;

    /**
     * @fieldName: vehicles
     * @fieldType: List<OrderDetail>
     * @Description: 运单详情（车辆信息）
     */
    private List<CWaybillDetailVo> vehicles = new ArrayList<CWaybillDetailVo>(0);

    ///剩余超时时间
    private long postTimeRemaining;

    // 车辆信息
    private String detail;

    //运单类型（个人接单、公司派单）
    private Integer bidderType;

    //运单类型显示文本
    private String bidderTypeText;

    //发车照片
    private List<AttachVo> sendPics;

    private DriverInfo driverInfo;

    //交车照片
    private List<AttachVo> deliverPics;

    // 是否是同城运单
    private Boolean isVeneer;

    private Date loadTime;

    private Date unloadTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getWaybillCode() {
        return waybillCode;
    }

    public void setWaybillCode(String waybillCode) {
        this.waybillCode = waybillCode;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getStatusText() {
        return status == null ? "" : WaybillStatusEnum.getByValue(status).getText();
    }

    public void setStatusText(String statusText) {
        this.statusText = statusText;
    }

    public long getPostTimeRemaining() {
        return postTimeRemaining;
    }

    public void setPostTimeRemaining(long postTimeRemaining) {
        this.postTimeRemaining = postTimeRemaining;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public Integer getBidderType() {
        return bidderType;
    }

    public void setBidderType(Integer bidderType) {
        this.bidderType = bidderType;
    }

    public String getBidderTypeText() {
        if (bidderType != null) {
            if (bidderType == UserTypeEnum.DRIVER.getValue()) {
                return "个人接单";
            } else if (bidderType == UserTypeEnum.COMPANY.getValue()) {
                return "公司派单";
            }
        }
        return "";
    }

    public void setBidderTypeText(String bidderTypeText) {
        this.bidderTypeText = bidderTypeText;
    }

    public List<AttachVo> getSendPics() {
        return sendPics;
    }

    public void setSendPics(List<AttachVo> sendPics) {
        this.sendPics = sendPics;
    }

    public List<AttachVo> getDeliverPics() {
        return deliverPics;
    }

    public void setDeliverPics(List<AttachVo> deliverPics) {
        this.deliverPics = deliverPics;
    }

    public DriverInfo getDriverInfo() {
        return driverInfo;
    }

    public void setDriverInfo(DriverInfo driverInfo) {
        this.driverInfo = driverInfo;
    }

    public String getDepartProvinceName() {
        return departProvinceName;
    }

    public void setDepartProvinceName(String departProvinceName) {
        this.departProvinceName = departProvinceName;
    }

    public String getDepartCityName() {
        return departCityName;
    }

    public void setDepartCityName(String departCityName) {
        this.departCityName = departCityName;
    }

    public String getReceiptProvinceName() {
        return receiptProvinceName;
    }

    public void setReceiptProvinceName(String receiptProvinceName) {
        this.receiptProvinceName = receiptProvinceName;
    }

    public String getReceiptCityName() {
        return receiptCityName;
    }

    public void setReceiptCityName(String receiptCityName) {
        this.receiptCityName = receiptCityName;
    }

    public String getShipmentDate() {
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if (null != isVeneer && isVeneer) {
            return sf.format(shipmentDate == null ? new Date() : shipmentDate);
        } else {
            return sf.format(shipmentDate == null ? new Date() : shipmentDate).substring(0, 10);
        }
    }

    public void setShipmentDate(Date shipmentDate) {
        this.shipmentDate = shipmentDate;
    }

    public String getArriveDate() {
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if (null != isVeneer && isVeneer) {
            return sf.format(arriveDate == null ? new Date() : arriveDate);
        } else {
            return sf.format(arriveDate == null ? new Date() : arriveDate).substring(0, 10);
        }
    }

    public void setArriveDate(Date arriveDate) {
        this.arriveDate = arriveDate;
    }

    public BigDecimal getCost() {
        return cost;
    }

    public void setCost(BigDecimal cost) {
        this.cost = cost;
    }

    public List<CWaybillDetailVo> getVehicles() {
        return vehicles;
    }

    public void setVehicles(List<CWaybillDetailVo> vehicles) {
        this.vehicles = vehicles;
    }

    public Integer getPayStatus() {
        return payStatus;
    }

    public void setPayStatus(Integer payStatus) {
        this.payStatus = payStatus;
    }

    public String getPayStatusText() {
        return payStatus == null ? "" : PaymentStatusEnum.getByValue(payStatus).getText();
    }

    public void setPayStatusText(String payStatusText) {
        this.payStatusText = payStatusText;
    }

    public String getDepartAddr() {
        return departAddr;
    }

    public void setDepartAddr(String departAddr) {
        this.departAddr = departAddr;
    }

    public String getReceiptAddr() {
        return receiptAddr;
    }

    public void setReceiptAddr(String receiptAddr) {
        this.receiptAddr = receiptAddr;
    }

    public String getDepartCountyName() {
        return departCountyName;
    }

    public void setDepartCountyName(String departCountyName) {
        this.departCountyName = departCountyName;
    }

    public String getReceiptCountyName() {
        return receiptCountyName;
    }

    public void setReceiptCountyName(String receiptCountyName) {
        this.receiptCountyName = receiptCountyName;
    }

    public String getDepartContact() {
        return departContact;
    }

    public void setDepartContact(String departContact) {
        this.departContact = departContact;
    }

    public String getDepartPhone() {
        return departPhone;
    }

    public void setDepartPhone(String departPhone) {
        this.departPhone = departPhone;
    }

    public String getReceiptContact() {
        return receiptContact;
    }

    public void setReceiptContact(String receiptContact) {
        this.receiptContact = receiptContact;
    }

    public String getReceiptPhone() {
        return receiptPhone;
    }

    public void setReceiptPhone(String receiptPhone) {
        this.receiptPhone = receiptPhone;
    }

    public Boolean getIsVeneer() {
        return isVeneer;
    }

    public void setIsVeneer(Boolean isVeneer) {
        this.isVeneer = isVeneer;
    }

    public Date getLoadTime() {
        return loadTime;
    }

    public void setLoadTime(Date loadTime) {
        this.loadTime = loadTime;
    }

    public Date getUnloadTime() {
        return unloadTime;
    }

    public void setUnloadTime(Date unloadTime) {
        this.unloadTime = unloadTime;
    }

    @Override
    public String toString() {
        return "WaybillNewVo [id=" + id + ", waybillCode=" + waybillCode + ", departProvinceName=" + departProvinceName
                + ", departCityName=" + departCityName + ", departCountyName=" + departCountyName + ", departContact="
                + departContact + ", departPhone=" + departPhone + ", receiptProvinceName=" + receiptProvinceName
                + ", receiptCityName=" + receiptCityName + ", receiptCountyName=" + receiptCountyName
                + ", receiptContact=" + receiptContact + ", receiptPhone=" + receiptPhone + ", departAddr=" + departAddr
                + ", receiptAddr=" + receiptAddr + ", shipmentDate=" + shipmentDate + ", arriveDate=" + arriveDate
                + ", status=" + status + ", statusText=" + statusText + ", payStatus=" + payStatus + ", payStatusText="
                + payStatusText + ", cost=" + cost + ", vehicles=" + vehicles + ", postTimeRemaining="
                + postTimeRemaining + ", detail=" + detail + ", bidderType=" + bidderType + ", bidderTypeText="
                + bidderTypeText + ", sendPics=" + sendPics + ", driverInfo=" + driverInfo + ", deliverPics="
                + deliverPics + ", isVeneer=" + isVeneer + ", loadTime=" + loadTime + ", unloadTime=" + unloadTime
                + "]";
    }

}